package com.hhkj.study.admin.config.model.res;

import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.Lists;
import com.hhkj.study.admin.config.model.podo.ConfigBasePo;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.List;
import java.util.Map;

/**
*
* @author SERVER
* @since 2024-09-06
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class ConfigBaseRes extends ConfigBasePo {

    /**
     * 课程名
     */
    private String courseTypeName;

    /**
     * 针对顶层元素才有值valueList
     */
    private List<String> valueList;

    /**
     * 省份
     */
    private String provinceNames;

    /**
     * 区域-区域名
     */
    private List<Map<String, Object>> provinceMap;

    /**
     * 区域id列表
     */
    private List<Long> provinceIdList;

    @JsonIgnore
    public List<Long> getProvinceIdList() {
        if (StrUtil.isBlank(getProvinceIds())) {
            return Lists.newArrayList();
        }
        return JSONUtil.toList(getProvinceIds(), Long.class);
    }
}